<template>
  <div>
    <el-row>
      <el-col :span="5" v-for="page in pages" :key="page._id" :offset="1">
        <el-card :body-style="{ padding: '0px', fontSize: '12px', textAlign: 'left'}">
          <img src="http://element.eleme.io/static/hamburger.50e4091.png" class="image">
          <div style="padding: 14px;">
            <span>{{page.title}}</span>
            <div class="bottom clearfix">
              <time class="time">{{ page._id }}</time>
              <el-button type="text" class="button" @click="goPage(page._id)">操作按钮</el-button>
              <a href=""></a>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<style lang="scss">
.image {
  width: 100%;
}
</style>

<script>
import axios from 'axios'
import router from '@/router'

export default {
  created () {
    var that = this
    axios.get('http://localhost:3100/page').then(function (res) {
      console.log(res)
      that.pages = res.data
    })
  },
  data () {
    return {
      pages: [],
      currentDate: new Date().toLocaleDateString()
    }
  },
  methods: {
    goPage (_id) {
      console.log(_id)
      router.push({path: `admin/${_id}`})
    }
  }
}
</script>
